<script type="application/javascript" src="<?=base_url()?>resource/js/jquery.PrintArea.js" ></script>
<script>
    function myform_submit() {
        //质检是否合格
        var isQcPass = $("input[name='isQcPass']:checked").val();
        if(!isQcPass){
            alert('<?=lang('product_qxzsfhg')?>');
            return false;
        }
        //描述是否一致
        var descriptionConsistent = $("input[name='descriptionConsistent']:checked").val();
        if(!descriptionConsistent){
            alert('<?=lang('product_qxzmssfxf')?>');
            return false;
        }
        //成色
        var physicalAppearance = $("input[name='physicalAppearance']:checked").val();
        if(!physicalAppearance){
            alert('<?=lang('product_qxzwgcs')?>');
            return false;
        }
        //附件
        var accessories = $("#accessoriesDivId :checkbox:checked");
        if(accessories.length<=0){
            alert('<?=lang('product_qxzfj')?>');
            return false;
        }
        //故障
        var fault = $("#faultDivId :checkbox:checked");
        if(fault.length<=0){
            alert('<?=lang('product_qxzgz')?>');
            return false;
        }
        var  merchant_num='<?=$orderFirst['merchant_num']?>';
        var ck_qc_sn=$('#ck_qc_sn').val();
        if(merchant_num=='1398'){
            if(ck_qc_sn==''){
                alert('此客户要求必须打印标签');
                return false;
            }
        }
        return true;
    }
    function print2(){
        var imei=$('#ck_qc_imei').val();
        var imeitwo=$('#ck_qc_imeitwo').val();
        var imeithree=$('#ck_qc_imeithree').val();
        var sn=$('#ck_qc_sn').val();
        var cmda=$('#ck_qc_cmda').val();
        if(imei.length > 20){
            alert('imei长度不能超过20');
            return false;
        }
        if(imeitwo.length > 20){
            alert('imei2长度不能超过20');
            return false;
        }
        if(imeithree.length > 20){
            alert('imei3长度不能超过20');
            return false;
        }
        if(sn.length > 20){
            alert('sn长度不能超过20');
            return false;
        }
        if(cmda.length > 20){
            alert('cmda长度不能超过20');
            return false;
        }
        $.post("<?=blang_url('ajax/ajax_two/serviceQcPrint')?>",{'imei':imei,'imeitwo':imeitwo,'imeithree':imeithree,'sn':sn,'cmda':cmda},function(data){
            if(data){
                var html= JSON.parse(data);
                var content="<div style='height: 6px;width: 50mm'> </div>"+html['imei']+"<div style='color: #0C0C0C;'>IMEI:"+imei+"</div>"+
                    html['imeitwo']+"<div style='color: #0C0C0C'>IMEI2:"+imeitwo+"</div>"+
                    "<div style='height: 11px;width: 50mm'> </div>"+html['imeithree']+"<div style='color: #0C0C0C'>IMEI3:"+imeithree+"</div>"+
                    html['sn']+"<div style='color: #0C0C0C'>SN:"+sn+"</div>"+
                    "<div style='height: 11px;width: 50mm'> </div>"+html['cmda']+"<div style='color: #0C0C0C'>CDMA:"+cmda+"</div> <style type=\"text/css\">#print > div {margin: 0 auto;}</style>";
                $('#print').html(content);
                $('#print').printArea();
                $('#print').attr('display','none');
            }
        });
    }
</script>

<!--top结束-->
<div class="mian">
    <div class="mian1">
        <div class="mian2">
            <!--left start-->
            <?php $this->load->view('defaults/common/left');?>
            <!--left end-->
            <!--right start-->
            <div class="right">
                <!--breadcrumb start-->
                <div class="righta"><?=$this->breadcrumb->generateHTML();?> </div>
                <!--breadcrumb end-->
                <!-- contents start -->
                <div id="contents">
                    <div id="contents_container">
                        <form action="<?=blang_url('products/Product_new/'.$post_type)?>" method="post" name="myform" onsubmit="return myform_submit()" autocomplete="off" >
                            <table cellpadding="0" cellspacing="0" id="table_forms" border="1">
                                <tr>
                                    <td class="forms_left"><?=lang('order_wxdh')?>:</td>
                                    <td ><?=$productFirst['order_num']?></td>
                                </tr>
                                <tr>
                                    <td class="forms_left"><?=lang('order_wxlx')?>:</td>
                                    <td ><?=$productFirst['serviceTypeName']?></td>
                                </tr>
                                <tr>
                                    <td class="forms_left"><?=lang('order_zt')?>:</td>
                                    <td ><?=$productFirst['statusName']?></td>
                                </tr>
                                <tr>
                                    <td class="forms_left"><?=lang('product_cplx')?>:</td>
                                    <td ><?=$productFirst['category_name']?></td>
                                </tr>
                                <tr>
                                    <td class="forms_left">SKU:</td>
                                    <td ><?=$productFirst['productSku']?></td>
                                </tr>
                                <?php if($productFirst['product_brand']): ?>
                                    <tr>
                                        <td class="forms_left">brand/model:</td>
                                        <td ><?=$productFirst['product_brand']?>/<?=$productFirst['product_model']?></td>
                                    </tr>
                                <?php endif;?>
                                <?php if($brandCustomer): ?>
                                    <tr>
                                        <td class="forms_left" ><?=lang('product_ppkhxx')?>:</td>
                                        <td colspan="2">
                                            <?=lang('product_ppkhmc')?>(<?=$brandCustomer['name']?>) &nbsp;&nbsp;
                                            <?=lang('product_ppkhbh')?>(<?=$brandCustomer['id']?>)
                                        </td>
                                    </tr>
                                <?php endif;?>
                                <tr>
                                    <td class="forms_left" ><?=lang('product_khbz')?>:</td>
                                    <td colspan="2">
                                        <?=$productFirst['customerRemark']?>
                                    </td>
                                </tr>
                                <?php if($productFirst['defectDes']): ?>
                                    <tr>
                                        <td class="forms_left" ><?=lang('product_gzms')?>:</td>
                                        <td colspan="2">
                                            <?=$productFirst['defectDes']?>
                                        </td>
                                    </tr>
                                <?php endif;?>

                                <tr>
                                    <td class="forms_left" ><?=lang('product_cpzt')?>:</td>
                                    <td >
                                        <input type="radio" name="available" value="0"  <?=$ckdAvailable['0']?>  />delete&nbsp;&nbsp;
                                        <input type="radio" name="available" value="1"  <?=$ckdAvailable['1']?> />normal&nbsp;&nbsp;
                                        <input type="radio" name="available" value="2"  <?=$ckdAvailable['2']?> />hold
                                    </td>
                                </tr>
                                    <tr>
                                        <td class="forms_left" ><?=lang('product_zjsfhg')?>:</td>
                                        <td >
                                            <input type="radio" name="isQcPass" value="0"  <?=$ckdIsQcPass['0']?>  />No&nbsp;&nbsp;
                                            <input type="radio" name="isQcPass" value="1"  <?=$ckdIsQcPass['1']?> />Yes
                                            &nbsp;&nbsp; Note：<?=lang('product_zjsfhgnote')?>
                                        </td>
                                    </tr>
                                <tr>
                                    <td class="forms_left" ><?=lang('product_mssfyz')?>:</td>
                                    <td >
                                        <input type="radio" name="descriptionConsistent" value="No"  <?=$ckdDesCst['No']?> />No&nbsp;&nbsp;
                                        <input type="radio" name="descriptionConsistent" value="Yes"  <?=$ckdDesCst['Yes']?>  />Yes
                                    </td>
                                </tr>
                                <tr>
                                    <td class="forms_left" >UDID:</td>
                                    <td>
                                        IMEI1:<input type="text" name="ck_qc_imei" id="ck_qc_imei">
                                        <?php if($orderFirst['merchant_num']==1398){?>
                                            IMEI2:<input type="text" name="ck_qc_imeitwo" id="ck_qc_imeitwo">
                                            IMEI3:<input type="text" name="ck_qc_imeithree" id="ck_qc_imeithree"><br>
                                            SN:<input type="text" name="ck_qc_sn" id="ck_qc_sn">
                                            CDMA:<input type="text" name="ck_qc_cmda" id="ck_qc_cmda">
                                            <input type="button" onclick="print2()" value=" 打 印 ">
                                            <span style="color: #ff0000"> :此客户要求必须打印标签</span>
                                        <?php }?>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="forms_left" ><?=lang('product_wgzk')?>:</td>
                                    <td >
                                        <?php foreach ($damageList as $rs):?>
                                            <input type="radio" name="physicalAppearance" value="<?=$rs['id']?>" <?=$ckdDamage[$rs['id']]?> /><?=$rs['name_'.$curLang]?>&nbsp;&nbsp;
                                        <?php endforeach;?>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="forms_left" ><?=lang('product_sjfj')?>:</td>
                                    <td colspan="2">
                                        <div id="accessoriesDivId">
                                            <?php foreach ($accessoriesList as $rs):?>
                                                <input type="checkbox" name="accessories[]" value="<?=$rs['id']?>" <?=$ckdAccessories[$rs['id']]?> ><?=$rs['name_'.$curLang]?>
                                            <?php endforeach;?>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="forms_left" ><?=lang('product_gz')?>:</td>
                                    <td colspan="2">
                                        <div id="faultDivId">
                                            <?php foreach ($faultList as $rs):?>
                                                <input type="checkbox" name="fault[]" value="<?=$rs['id']?>"  <?=$ckdFault[$rs['id']]?> ><?=$rs['name_'.$curLang]?>
                                            <?php endforeach;?>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="forms_left" ><?=lang('product_zjbz')?>:</td>
                                    <td colspan="2">
                                        <textarea name="exitQC" rows="3" cols="40"><?=$productFirst['exitQC']?></textarea>
                                    </td>
                                </tr>

                                <tr>
                                    <td align="center" colspan="2" class="sub_padding_right">
                                        <input name="id" type="hidden" value="<?=$productFirst['id']?>" />
                                        <input type="submit" value="<?=lang('public_tj')?>" name="submits" />
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
                <!-- contents end -->
            </div>
            <!--right end-->
            <div class="clear"></div>
        </div>
    </div>
</div>

<div id="print" style="font-size: 8px;padding:0;height:29.9mm;width:50mm;over-flow:hidden;text-align: center;">

</div>
